Skip to content

[SDK] Replace SpinLockMutex with std::mutex in the metrics library - #4416

Open
dbarker wants to merge 10 commits into
open-telemetry:mainfrom
dbarker:sdk_swap_spinlock_for_mutex_part_2
Open

[SDK] Replace SpinLockMutex with std::mutex in the metrics library#4416
dbarker wants to merge 10 commits into
open-telemetry:mainfrom
dbarker:sdk_swap_spinlock_for_mutex_part_2

Conversation

@dbarker

@dbarker dbarker commented Aug 11, 2026

Copy link
Copy Markdown
Member

Fixes #4317

Part 2 of #4317 to replace SpinLockMutex with std::mutex.

This PR replaces all use of the SpinLockMutex in the metrics sdk. The goal is to improve synchronization consistency across platforms and deployments by relying on the standard mutex.

Changes

  • Replaces SpinLockMutex with std::mutex in the metrics storage classes.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.12%. Comparing base (cd252b4) to head (47c05e5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4416      +/-   ##
==========================================
+ Coverage   83.09%   83.12%   +0.03%     
==========================================
  Files         519      519              
  Lines       20253    20256       +3     
==========================================
+ Hits        16827    16835       +8     
+ Misses       3426     3421       -5     
Files with missing lines Coverage Δ
...telemetry/sdk/metrics/state/async_metric_storage.h 93.19% <100.00%> (ø)
...ntelemetry/sdk/metrics/state/sync_metric_storage.h 84.94% <ø> (ø)
sdk/src/metrics/state/sync_metric_storage.cc 93.69% <100.00%> (ø)
sdk/src/metrics/state/temporal_metric_storage.cc 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h Outdated
@dbarker
dbarker marked this pull request as ready for review August 12, 2026 16:14
@dbarker
dbarker requested a review from a team as a code owner August 12, 2026 16:14
Comment thread sdk/src/metrics/state/sync_metric_storage.cc
@dbarker dbarker added the discuss To discuss in SIG meeting label Aug 24, 2026
@dbarker dbarker added pr:please-review This PR is ready for review and removed discuss To discuss in SIG meeting labels Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:please-review This PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Replace SpinLockMutex with std::mutex where appropriate

4 participants